package SocialMediaSentiment;

import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;

public class CorrectTweets  extends StandardFunctions{

	public static void main( String args[] ){
		test();

	}
	
	public static void test(){
		int  sentiment;
		HashMap <String, Integer> tweets = new HashMap<String, Integer>();
		String tweet;
		String file = "Trainset.xls";
		try {
			HashMap<Integer, String[]> temp = ReadExcel.read(file, 9, 4);
			Iterator<Integer> k = temp.keySet().iterator();
			int amountOftweets = temp.size(),done = 1;
			String[] data;
			while(k.hasNext()){
				System.out.println(done+"\t"+(double)(done/amountOftweets)*100);
				done++;
				data = temp.get(k.next());
				tweet = data[0];
				sentiment = Integer.parseInt(data[1]);
				System.out.println(tweet);
				tweet = CorrectTweet(tweet);			
				System.out.println(tweet);
				tweets.put( tweet, sentiment );
			}
		} catch (IOException e) {
			e.printStackTrace();
			System.err.println("Unable to read "+file);
		}
		
		writeSentimentsToFile(tweets);
	}

}
